package com.ruoyi.course.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.course.mapper.THomeworkMapper;
import com.ruoyi.course.domain.THomework;
import com.ruoyi.course.service.ITHomeworkService;

/**
 * 作业Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-11-30
 */
@Service
public class THomeworkServiceImpl implements ITHomeworkService 
{
    @Autowired
    private THomeworkMapper tHomeworkMapper;

    /**
     * 查询作业
     * 
     * @param id 作业主键
     * @return 作业
     */
    @Override
    public THomework selectTHomeworkById(Long id)
    {
        return tHomeworkMapper.selectTHomeworkById(id);
    }

    /**
     * 查询作业列表
     * 
     * @param tHomework 作业
     * @return 作业
     */
    @Override
    public List<THomework> selectTHomeworkList(THomework tHomework)
    {
        return tHomeworkMapper.selectTHomeworkList(tHomework);
    }

    /**
     * 新增作业
     * 
     * @param tHomework 作业
     * @return 结果
     */
    @Override
    public int insertTHomework(THomework tHomework)
    {
        tHomework.setCreateTime(DateUtils.getNowDate());
        return tHomeworkMapper.insertTHomework(tHomework);
    }

    /**
     * 修改作业
     * 
     * @param tHomework 作业
     * @return 结果
     */
    @Override
    public int updateTHomework(THomework tHomework)
    {
        tHomework.setUpdateTime(DateUtils.getNowDate());
        return tHomeworkMapper.updateTHomework(tHomework);
    }

    /**
     * 批量删除作业
     * 
     * @param ids 需要删除的作业主键
     * @return 结果
     */
    @Override
    public int deleteTHomeworkByIds(Long[] ids)
    {
        return tHomeworkMapper.deleteTHomeworkByIds(ids);
    }

    /**
     * 删除作业信息
     * 
     * @param id 作业主键
     * @return 结果
     */
    @Override
    public int deleteTHomeworkById(Long id)
    {
        return tHomeworkMapper.deleteTHomeworkById(id);
    }
}
